#include <ppl/cv/x86/cvtcolor.h>
#include <stdlib.h>
#include <chrono>
#include <iostream>

using namespace std;
using namespace std::chrono;

int32_t main(int32_t argc, char** argv) {
    const int32_t W = 3840;
    const int32_t H = 2160;
    const int32_t input_channels = 1;
    const int32_t output_channels = 3;
    uint8_t* iImage = (uint8_t*)malloc(W * H * sizeof(uint8_t) * 3 / 2);
    uint8_t* oImage = (uint8_t*)malloc(W * H * output_channels * sizeof(uint8_t));
    
    for(int i = 0; i < 20; ++i){
        auto start = system_clock::now();
        ppl::cv::x86::NV122BGR<uint8_t>(H, W, W * input_channels, iImage, W * output_channels, oImage);
        auto end = system_clock::now();
        double duration_millsecond = std::chrono::duration<double, std::milli>(end - start).count();
        cout << "using: "
                << duration_millsecond << " "
                << "ms" << endl; 
    }
    free(iImage);
    free(oImage);
    return 0;
}
